package adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zzhoujay.richtext.ImageHolder;
import com.zzhoujay.richtext.RichText;

import java.util.List;

import bean.QuestionDetailBean;
import student.andlei.com.student.R;
import utils.ImageLoaderUtils;

/**
 * author : ChenHuiMing
 * date : 2018/9/15
 * email : 907399255@qq.com
 * description : 答问模块左边适配器
 */
public class IntersionDetailAdapter extends BaseQuickAdapter<QuestionDetailBean.ListBean, BaseViewHolder> {
    public IntersionDetailAdapter(int layoutResId, @Nullable List<QuestionDetailBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, QuestionDetailBean.ListBean item) {
        ImageView imageView = helper.getView(R.id.civ_logo);
        TextView textView = helper.getView(R.id.tv_question);
        ImageLoaderUtils.loadCircleImage(mContext, item.head_image, imageView);
        helper.setText(R.id.tv_name, item.real_name).setVisible(R.id.ll_info, false).setText(R.id.tv_time, item.create_time);

        RichText.initCacheDir(mContext);
        RichText.from(item.replay_content).bind(this)
                .showBorder(false)
                .size(ImageHolder.MATCH_PARENT, ImageHolder.WRAP_CONTENT)
                .into(textView);
    }
}
